load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "storage",
    srcs = [
        "azblob.go",
        "compress.go",
        "flags.go",
        "gcs.go",
        "gcs_extra.go",
        "hdfs.go",
        "helper.go",
        "ks3.go",
        "local.go",
        "local_unix.go",
        "local_windows.go",
        "locking.go",
        "memstore.go",
        "noop.go",
        "parse.go",
        "s3.go",
        "storage.go",
        "writer.go",
    ],
    importpath = "github.com/pingcap/tidb/br/pkg/storage",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/errors",
        "//br/pkg/logutil",
        "//pkg/lightning/log",
        "//pkg/sessionctx/variable",
        "//pkg/util",
        "//pkg/util/intest",
        "//pkg/util/logutil",
        "//pkg/util/prefetch",
        "@com_github_aliyun_alibaba_cloud_sdk_go//sdk/auth/credentials",
        "@com_github_aliyun_alibaba_cloud_sdk_go//sdk/auth/credentials/providers",
        "@com_github_aws_aws_sdk_go//aws",
        "@com_github_aws_aws_sdk_go//aws/awserr",
        "@com_github_aws_aws_sdk_go//aws/client",
        "@com_github_aws_aws_sdk_go//aws/credentials",
        "@com_github_aws_aws_sdk_go//aws/credentials/stscreds",
        "@com_github_aws_aws_sdk_go//aws/request",
        "@com_github_aws_aws_sdk_go//aws/session",
        "@com_github_aws_aws_sdk_go//service/s3",
        "@com_github_aws_aws_sdk_go//service/s3/s3iface",
        "@com_github_aws_aws_sdk_go//service/s3/s3manager",
        "@com_github_azure_azure_sdk_for_go_sdk_azcore//:azcore",
        "@com_github_azure_azure_sdk_for_go_sdk_azcore//policy",
        "@com_github_azure_azure_sdk_for_go_sdk_azidentity//:azidentity",
        "@com_github_azure_azure_sdk_for_go_sdk_storage_azblob//:azblob",
        "@com_github_azure_azure_sdk_for_go_sdk_storage_azblob//blob",
        "@com_github_azure_azure_sdk_for_go_sdk_storage_azblob//bloberror",
        "@com_github_azure_azure_sdk_for_go_sdk_storage_azblob//blockblob",
        "@com_github_azure_azure_sdk_for_go_sdk_storage_azblob//container",
        "@com_github_go_resty_resty_v2//:resty",
        "@com_github_google_uuid//:uuid",
        "@com_github_klauspost_compress//gzip",
        "@com_github_klauspost_compress//snappy",
        "@com_github_klauspost_compress//zstd",
        "@com_github_ks3sdklib_aws_sdk_go//aws",
        "@com_github_ks3sdklib_aws_sdk_go//aws/awserr",
        "@com_github_ks3sdklib_aws_sdk_go//aws/credentials",
        "@com_github_ks3sdklib_aws_sdk_go//service/s3",
        "@com_github_ks3sdklib_aws_sdk_go//service/s3/s3manager",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_pingcap_log//:log",
        "@com_github_spf13_pflag//:pflag",
        "@com_google_cloud_go_storage//:storage",
        "@org_golang_google_api//googleapi",
        "@org_golang_google_api//iterator",
        "@org_golang_google_api//option",
        "@org_golang_google_api//transport/http",
        "@org_golang_x_net//http2",
        "@org_golang_x_oauth2//google",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "storage_test",
    timeout = "short",
    srcs = [
        "azblob_test.go",
        "compress_test.go",
        "gcs_test.go",
        "local_test.go",
        "locking_test.go",
        "memstore_test.go",
        "parse_test.go",
        "s3_test.go",
        "storage_test.go",
        "writer_test.go",
    ],
    embed = [":storage"],
    flaky = True,
    shard_count = 50,
    deps = [
        "//br/pkg/mock",
        "//pkg/util/intest",
        "@com_github_aws_aws_sdk_go//aws",
        "@com_github_aws_aws_sdk_go//aws/awserr",
        "@com_github_aws_aws_sdk_go//aws/request",
        "@com_github_aws_aws_sdk_go//service/s3",
        "@com_github_azure_azure_sdk_for_go_sdk_storage_azblob//:azblob",
        "@com_github_azure_azure_sdk_for_go_sdk_storage_azblob//bloberror",
        "@com_github_fsouza_fake_gcs_server//fakestorage",
        "@com_github_klauspost_compress//zstd",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_stretchr_testify//require",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_mock//gomock",
    ],
)
